﻿/// <reference path="RequestHandler.js" />
/// <reference path="../HttpRequest.js" />
/// <reference path="../../utilities/FXDom.js" />
/// <reference path="../../utilities/Markup.js" />
///--------------------------------------------------------------------
/// <file name="NewCustomSmileyHandler.js">
///   Assesses whether a new custom smiley has been uploaded. If
///   so, updates the appropriate services.
/// </file>
///--------------------------------------------------------------------

NAMFox.ns(function() { with (NAMFox) {

this.NewCustomSmileyHandler = function() {
};

NewCustomSmileyHandler.prototype = new RequestHandler();
NewCustomSmileyHandler.prototype.name = "NewCustomSmileyHandler";

NewCustomSmileyHandler.prototype.handleRequestCore = function(request, _$) {
    /// <summary>Handles a request.</summary>
    /// <param name="request" type="HttpRequest">
    ///   The HTTP request which encapsulates the
    ///   document and route data for this request.
    /// </param>

    var notice = _$("td.h b font");
    
    if (notice.length === 0) {
        return;
    }
    
    if (notice.html() === "Successfully updated your custom smilie!") {
        $.updateCustomSmileys();
    }
};

}});